<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>收支查询</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    

	<link href="css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=path%>/script/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="script/jquery-1.8.1.min.js"></script>
	<script type="text/javascript" src="script/common.js"></script>
	<script type="text/javascript" >
		
		function goPage(currentPage){
			
			var id = $.trim($("#id").val());
			var option = $.trim($("#option").val())
			var startDate = $.trim($("#startDate").val());
			var endDate = $.trim($("#endDate").val());
			if($.trim($("#payType").val()) == '货到付款'){
				var	 payType = 1;
			}else if($.trim($("#payType").val()) == '款到发货'){
				var payType = 2;
			}else if($.trim($("#payType").val()) == '预付款到发货'){
				var payType = 3;
			}
			
			if(option == "--请选择--"){
				//goPage(1)
				alert("请先选择收支类型")
			}else if(option == "支出"){
				if(payType == "--请选择--"){
					var params = {"currentPage" : currentPage, "id" : id,"option" : option,"startDate":startDate,"endDate":endDate};
					$("#dataList").load("main/finance/pomainqueryDetail",params);
				}else{
					var params = {"currentPage" : currentPage, "id" : id,"option" : option,"payType":payType,"startDate":startDate,"endDate":endDate};
					$("#dataList").load("main/finance/pomainqueryDetail",params);
				}
			}else if (option == "收入"){
				if(payType == "--请选择--"){
					var params = {"currentPage" : currentPage, "id" : id,"option" : option,"startDate":startDate,"endDate":endDate};
					$("#dataList").load("main/finance/somainqueryDetail",params);
				}else{
					var params = {"currentPage" : currentPage, "id" : id,"option" : option,"payType":payType,"startDate":startDate,"endDate":endDate};
					$("#dataList").load("main/finance/somainqueryDetail",params);
				}
			}
		}
	</script>
  </head>
  
  <body>
  <div>
   	<table  width="100%" border="0" cellpadding="0" cellspacing="0">
   		<tr >
   			<td class="title1">您的位置：财务收支－－收支查询</td>
   		</tr>
   	</table>
   	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="30px" class="toolbar">&nbsp;</td>
			<td nowrap class="toolbar">&nbsp;</td>
		</tr>
	</table>
		<%
			//查询条件
			String id = request.getParameter("id");
			String option = request.getParameter("option");
			String payType = request.getParameter("payType");
			String startDate = request.getParameter("startDate");
			String endDate = request.getParameter("endDate");

			id = id == null ? "" : id;
			option = option == null ? "" : option;
			payType = payType == null ? "" : payType;
			startDate = startDate == null ? "" : startDate;
			endDate = endDate == null ? "" : endDate;
		%>
	<table width="100%"  border="0" align="center" cellspacing="1" class="c">
 		 <tr>
		   	 <td align="center">
		   	 	收支类型: <select name="selectClass" id="option" value="<%=option %>">
			    				<option>--请选择--</option>
			    				<option>收入</option>
			    				<option>支出</option>
		    			</select>
		    </td>
		    <td align="center">
		   	 	产品单号：<input type="text" name="id" id="id" value="<%=id%>">
		   	</td>
		   	<td align="center">
		    	单据付款方式: <select name="select"  id="payType" value="<%=payType %>">
		    					<option>--请选择--</option>
			    				<option>货到付款</option>
			    				<option>款到发货</option>
			    				<option>预付款到发货</option>
		    				</select>
		   	</td>
		    <td align="center">			
		    	日期段： <input class="Wdate" type="text" id="startDate" value="<%=startDate%>" onFocus="WdatePicker({isShowClear:true,readOnly:true})" /> 
						- 
						<input class="Wdate" type="text" id="endDate" value="<%=endDate%>" onFocus="WdatePicker({isShowClear:true,readOnly:true})" /> 
			</td>
			<td align="center">
				<input type="button" id="btn1" value="查询" onclick="goPage(1)" />
			</td>
  	  </tr>
	</table>
  </div>
  <div id="dataList"></div>
  </body>
</html>
